package com.common.oss.controller;

import com.common.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/oss")
public class OssTestController {

    @Autowired
    private OssService ossService;

    //上传文件 文件名
    @PostMapping("/uploadFile")
    public String uploadFile(@RequestParam("file") MultipartFile multipartFile){
        return ossService.uploadMultipartFile(multipartFile);
    }

    @PostMapping("/uploadFileToPath")
    public String uploadFileToPath(@RequestParam("path") String path){
        return ossService.uploadFile(path);
    }
}
